#include "texture.h"
#include "game.h"
#include <d3dx9.h>
#pragma comment(lib, "d3dx9.lib")

/**
 * Laduje zasob.
 */
bool Texture::load()
{
	if(texture)
		unload();

	if(FAILED(D3DXCreateTextureFromFileInMemory(Game::getGraphics()->getDevice(),
		getData(), getDataSize(), &texture)))
		return false;

	texture->GenerateMipSubLevels();

	return true;
}


/**
 * ...
 */
void Texture::unload()
{
	if(texture)
	{
		texture->Release();
		texture = NULL;
	}
}
